package ar.edu.uba.fi.jmit.monitorengine.backend.client.view;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class ConfigurationFilePanel extends DialogBox {
	
	private Button close;
	
	public ConfigurationFilePanel(String textToShow) {
		super();
		VerticalPanel panel = new VerticalPanel();
		this.showText(panel, textToShow);
		panel.add(this.createButtonsPanel());
		this.setWidget(panel);
	}

	private void showText(Panel panel, String textToShow) {
		panel.add(new HTML("<p> " + ViewUtils.htmlize(textToShow) + "</p>"));
	}
	
	public void closePanel() {
		this.hide();
	}
	
	
	private Widget createButtonsPanel() {
		Panel panel = new HorizontalPanel();
		close = new Button("Close");
		panel.add(close);
		close.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent arg0) {
				closePanel();
				
			}
			
		});
		return panel;
	}

}
